from qcloudsms_py import SmsSingleSender
from qcloudsms_py.httpclient import HTTPError
import ssl
ssl._create_default_https_context = ssl._create_unverified_context

# 短信应用SDK AppID
appid = 1400373174  # SDK AppID是1400开头

# 短信应用SDK AppKey
appkey = "7b8eebd19d6600c45333aba5ab62796d"

# 需要发送短信的手机号码
phone_numbers = ["13439632718"]

# 短信模板ID，需要在短信应用中申请
template_id = 614434  

# 签名
sms_sign = "刘悦的技术博客"

ssender = SmsSingleSender(appid, appkey)
params = ["6666","5"]  # 当模板没有参数时，`params = []`
try:
    result = ssender.send_with_param(86, phone_numbers[0],
        template_id, params, sign=sms_sign, extend="", ext="")  # 签名参数不允许为空串
    print(result)
except HTTPError as e:
    print(e)
except Exception as e:
    print(e)




